<!--{include manage_header}-->
    <script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/manage/ueditor1/lang/zh-cn/zh-cn.js"></script>

    <style type="text/css">
        .clear {
            clear: both;
        }
    </style>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
    <li><a href="/manage/news/index.php">新闻设置</a></li>
    <li><a href="/manage/news/index.php">编辑新闻</a></li>
	<li style="float:right;  font-size:22px; ">
	 <a href="javascript::" style="padding-right:30px;color:#3B95C8;">
    <!--{if $_SESSION['ali_token']}-->${mb_strimwidth($login_user['realname'],0,10)}<!--{else}-->${mb_strimwidth($login_user['username'],0,10)}<!--{/if}-->
	</a> </li>
    </ul>
</div>    
    
<div id="bdw" class="bdw">
<div id="bd" class="cf">
<div id="leader">
	<!--<div class="dashboard" id="dashboard">
		<ul>${mcurrent_news('news')}</ul>
	</div>-->
	<div id="content" class="clear mainwide">
        <div class="clear box">
            <div class="box-top"></div>
            <div class="box-content">
                <div class="head">
				<!--{if $news['id']}-->
                    <div class="formtitle" style="padding-left:6px;"><span>编辑新闻</span></div>
					<!--<ul class="filter">${current_managenews('edit', $news['id'])}</ul>-->
				<!--{else}-->
                    <div class="formtitle" style="padding-left:6px;"><span>新建新闻</span></div>
				<!--{/if}-->
				</div>
                <div class="sect">
				<form id="-user-form" method="post" action="/manage/news/edit.php?id={$news['id']}" enctype="multipart/form-data" class="validator">
					<input type="hidden" name="id" value="{$news['id']}" />
					<div class="field">
						<label>新闻标题</label>
						<input type="text" size="30" name="title" id="team-create-title" class="f-input" value="${htmlspecialchars($news['title'])}" datatype="require" require="true" />
					</div>
						<div class="field">
							<label>图片</label>
							<input type="file" size="30" name="upload_image" id="team-create-image" class="f-input f-hint" />
							<!--{if $news['image']}--><span class="hint">${team_image($news['image'])}</span><!--{/if}-->
						</div>
						<div class="field">
						<label>新闻分类</label>
						<select name="type" class="f-input" style="width:160px;" onchange="X.team.changetype(this.options[this.options.selectedIndex].value);">${Utility::Option($groups, $news['type'])}</select>

					</div>
						<div class="field">
						<label>排序</label>
						<input type="text" size="10" name="tuijian" id="team-create-sort_order" class="number" value="${$news['tuijian'] ? $news['tuijian'] : 0}" datatype="number"/><span class="inputtip">请填写数字，数值大到小排序，主推团购应设置较大值</span>
					</div>
					
					<div class="field">
						<label>开始时间</label>
						<input type="text" size="10" name="begin_time" id="team-create-begin-time" class="date" xd="${date('Y-m-d', $news['begin_time'])}" xt="${date('H:i:s', $news['begin_time'])}" value="${date('Y-m-d H:i:s', $news['begin_time'])}" maxLength="10" />
					</div>
					<div class="field">
						<label>新闻内容</label>
						<div style="float:left;">
						<textarea cols="45" rows="5" name="detail" id="forum-new-content3" class="f-textarea editor">${htmlspecialchars($news['detail'])}</textarea>
						</div>
					</div>
					
                    <div class="field">
					<input type="submit" value="提交" name="commit" id="leader-submit" class="formbutton" style="margin:10px 0 0 120px;"/>
                    </div>
				</form>
                </div>
            </div>
            <div class="box-bottom"></div>
        </div>
	</div>
</div>
</div> <!-- bd end -->
</div> <!-- bdw end -->
<script type="text/javascript">
window.x_init_hook_teamchangetype = function(){
	X.team.changetype("{$team['team_type']}");
};
window.x_init_hook_page = function() {
	X.team.imageremovecall = function(v) {
		jQuery('#team_image_'+v).remove();
	};
	X.team.imageremove = function(id, v) {
		return !X.get(WEB_ROOT + '/ajax/misc.php?action=imageremove&id='+id+'&v='+v);
	};
};
</script>

<script type="text/javascript">

    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    UE.getEditor('editor');


    function isFocus(e){
        alert(UE.getEditor('editor').isFocus());
        UE.dom.domUtils.preventDefault(e)
    }
    function setblur(e){
        UE.getEditor('editor').blur();
        UE.dom.domUtils.preventDefault(e)
    }
    function insertHtml() {
        var value = prompt('插入html代码', '');
        UE.getEditor('editor').execCommand('insertHtml', value)
    }
    function createEditor() {
        enableBtn();
        UE.getEditor('editor');
    }
    function getAllHtml() {
        alert(UE.getEditor('editor').getAllHtml())
    }
    function getContent() {
        var arr = [];
        arr.push("使用editor.getContent()方法可以获得编辑器的内容");
        arr.push("内容为：");
        arr.push(UE.getEditor('editor').getContent());
        alert(arr.join("\n"));
    }
    function getPlainTxt() {
        var arr = [];
        arr.push("使用editor.getPlainTxt()方法可以获得编辑器的带格式的纯文本内容");
        arr.push("内容为：");
        arr.push(UE.getEditor('editor').getPlainTxt());
        alert(arr.join('\n'))
    }
    function setContent(isAppendTo) {
        var arr = [];
        arr.push("使用editor.setContent('欢迎使用ueditor')方法可以设置编辑器的内容");
        UE.getEditor('editor').setContent('欢迎使用ueditor', isAppendTo);
        alert(arr.join("\n"));
    }
    function setDisabled() {
        UE.getEditor('editor').setDisabled('fullscreen');
        disableBtn("enable");
    }

    function setEnabled() {
        UE.getEditor('editor').setEnabled();
        enableBtn();
    }

    function getText() {
        //当你点击按钮时编辑区域已经失去了焦点，如果直接用getText将不会得到内容，所以要在选回来，然后取得内容
        var range = UE.getEditor('editor').selection.getRange();
        range.select();
        var txt = UE.getEditor('editor').selection.getText();
        alert(txt)
    }

    function getContentTxt() {
        var arr = [];
        arr.push("使用editor.getContentTxt()方法可以获得编辑器的纯文本内容");
        arr.push("编辑器的纯文本内容为：");
        arr.push(UE.getEditor('editor').getContentTxt());
        alert(arr.join("\n"));
    }
    function hasContent() {
        var arr = [];
        arr.push("使用editor.hasContents()方法判断编辑器里是否有内容");
        arr.push("判断结果为：");
        arr.push(UE.getEditor('editor').hasContents());
        alert(arr.join("\n"));
    }
    function setFocus() {
        UE.getEditor('editor').focus();
    }
    function deleteEditor() {
        disableBtn();
        UE.getEditor('editor').destroy();
    }
    function disableBtn(str) {
        var div = document.getElementById('btns');
        var btns = domUtils.getElementsByTagName(div, "button");
        for (var i = 0, btn; btn = btns[i++];) {
            if (btn.id == str) {
                domUtils.removeAttributes(btn, ["disabled"]);
            } else {
                btn.setAttribute("disabled", "true");
            }
        }
    }
    function enableBtn() {
        var div = document.getElementById('btns');
        var btns = domUtils.getElementsByTagName(div, "button");
        for (var i = 0, btn; btn = btns[i++];) {
            domUtils.removeAttributes(btn, ["disabled"]);
        }
    }

    function getLocalData () {
        alert(UE.getEditor('editor').execCommand( "getlocaldata" ));
    }

    function clearLocalData () {
        UE.getEditor('editor').execCommand( "clearlocaldata" );
        alert("已清空草稿箱")
    }

</script>
<!--{include manage_footer}-->
